/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.uoc.tfc.exuoc.consultes;
import edu.uoc.tfc.exuoc.config.Config;


import java.util.Date;
import java.io.Serializable;

/**
 *
 * @author emili
 */
/**
 *  Classe creada per a generar la llista de contenidors que s'utilitza a
 *  Les pàgines jsp i per les cerques.
 * @author emili
 */
   public  class ContenidorLlistat implements Serializable, Comparable{
        Long id=Config.valorNull;
        String nom = Config.valorNullStr;
        Date dataPub=new java.util.Date();
        Integer numItems=Config.valorNullInt;

       public ContenidorLlistat(){ super();}
       public ContenidorLlistat(Long _id, String _nom, Date _dataPub,Integer num){
            this.id=_id;
            this.nom=_nom;
            this.dataPub=_dataPub;
            this.numItems=num;
        }

    public Date getDataPub() {
        return dataPub;
    }

    public void setDataPub(Date dataPub) {
        this.dataPub = dataPub;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Integer getNumItems() {
        return numItems;
    }

    public void setNumItems(Integer numItems) {
        this.numItems = numItems;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ContenidorLlistat other = (ContenidorLlistat) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.nom == null) ? (other.nom != null) : !this.nom.equals(other.nom)) {
            return false;
        }
        if (this.dataPub != other.dataPub && (this.dataPub == null || !this.dataPub.equals(other.dataPub))) {
            return false;
        }
        return true;
    }



    @Override
    public int hashCode() {
        int hash = 5;
        hash = 19 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 19 * hash + (this.nom != null ? this.nom.hashCode() : 0);
        hash = 19 * hash + (this.dataPub != null ? this.dataPub.hashCode() : 0);
        return hash;
    }

    public int compareTo(Object o) {
        ContenidorLlistat ll =null;
        if (o == null) {
            return -2;
        }
        if (getClass() != o.getClass()) {
           return -2;
        }
        ll=(ContenidorLlistat)o;
        return this.id.compareTo(ll.getId());
        }


    }